package org.xb.proxy;

import java.util.List;

import org.xb.dao.AdminDAO;
import org.xb.dao.AdminDAOImpl;
import org.xb.dbc.DatebaseConnection;
import org.xb.vo.Admin;

public class AdminDAOProxy implements AdminDAO {
private DatebaseConnection dbc;
private AdminDAO dao;
public AdminDAOProxy(){
	this.dbc=new DatebaseConnection();
	this.dao=new AdminDAOImpl(this.dbc.getConnection());
}
public Admin findLogin(String adname,String adpassword)throws Exception{
	Admin admin=null;
	try{
		admin=this.dao.findLogin(adname,adpassword);
	}catch(Exception e){
		throw e;
	}finally{
		this.dbc.close();
	}
	return admin;
}
public boolean doCreate(Admin admin) throws Exception {
	boolean flag=false;
	try{
		flag=this.dao.doCreate(admin);
	}catch(Exception e){
		throw e;
	}finally{
		this.dbc.close();
	}
	return flag;
}
public Admin findById(Integer id) throws Exception {
	Admin admin=null;
	try{
		admin=this.dao.findById(id);
	}catch(Exception e){
		throw e;
	}finally{
		this.dbc.close();
	}
	return admin;
}
public long getCount(String keyword) throws Exception {
	
	return 0;
}
public List<Admin> listAll(String keyword, int currentPage, int lineSize)
		throws Exception {

	return null;
}
public boolean doDelete(Admin admin) throws Exception {
	boolean flag=false;
	try{
		flag=this.dao.doDelete(admin);
	}catch(Exception e){
		throw e;
	}finally{
		this.dbc.close();
	}
	return flag;
}
public boolean doUpdate(Admin admin) throws Exception {
	boolean flag=false;
	try{
		flag=this.dao.doUpdate(admin);
		
	}catch(Exception e){
		throw e;
	}finally{
		this.dbc.close();
	}
	return flag;
}
}
